<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ page import="myhistory.*" import="java.util.* " import="java.text.*" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>访问记录</title>
<link rel="stylesheet" type="text/css" href="lib.css">
</head>
<body>
<br><br>
<a href="main.jsp">主页面</a> <a href="login.jsp">登录页面</a> <a href="online.jsp">在线用户</a> <a href="visitor.jsp">历史访客</a>  <a href="history.jsp">访问记录</a> <br><br>
<table border="1" class="imagetable">
  <tr>
    <th>序号</th>
    <th>访问id</th>
    <th>访问时间</th>
    <th>来自的URL</th>
  </tr>
  
  <%
  
  HistoryDao dao=new HistoryDao();
  dao.setPageSize(10);	//声明显示一页显示10条数据
  if(session.getAttribute("page")==null){
	  dao.setPageNo(1);
	  session.setAttribute("page",1);
  }else{
	  dao.setPageNo(Integer.parseInt(session.getAttribute("page").toString()));
  }
  dao.computePageCount();	//得到总页数
  ArrayList<History> al=dao.getPageData();
  
  
  int i=0;
  for(History his:al){
	  i++;  
	  
	  
	  //时间的格式
	  SimpleDateFormat sFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
	  String vTime=sFormat.format(his.getVisittime());
	  
  %>
 
  <tr>
    <td><%=i %></td>
    <td><%=his.getVisitId() %></td>
    <td><%=vTime %></td>
    <td><%=his.getUrl() %></td>
  </tr>
  <%
  
  }
  
  %>
  
</table>
<a href="PageServlet?op=back">上一页</a>   <%=session.getAttribute("page") %>/<%=dao.getPageCount() %> <a href="PageServlet?op=next">下一页</a>

</body>
</html>